package com.htl.io.缓冲流;

import java.io.*;

/**
 *  字节输出缓冲流 BufferedOutputStream
 */

public class BufferedOutputStream__test {
    public static void main(String[] args) {
        OutputStream outputStream = null;
        BufferedOutputStream bufferedOutputStream = null;
        try {
            outputStream = new FileOutputStream("D:\\Project\\IDEA_project\\java_note\\src\\com\\htl\\io\\缓冲流\\demo.txt");
            bufferedOutputStream = new BufferedOutputStream(outputStream);
            String str = "使用了【字节输出缓冲流】 BufferedOutputStream";
            bufferedOutputStream.write(str.getBytes());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                bufferedOutputStream.flush();
                bufferedOutputStream.close();
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
